hysop.backend.host.python.operator.diffusion module

class hysop.backend.host.python.operator.diffusion.PythonDiffusion(Fin, Fout, variables, nu, dt, name=None, pretty_name=None, **kwds)[source]

Bases: DiffusionOperatorBase, OpenClMappable, HostOperator

Solves the implicit diffusion equation using numpy fft.

Diffusion operator base.

Parameters:
  • Fin (Field) – The input field to be diffused.

  • Fout (Field) – The output field to be diffused.

  • variables (dictionary of fields:topology) – The choosed discretizations.

  • nu (ScalarParameter.) – Diffusion coefficient.

  • dt (ScalarParameter) – Timestep parameter that will be used for time integration.

  • kargs – Base class parameters.

  • Notes

    *Equations:

    dF/dt = nu*Laplacian(F) in = Win out = Wout

    *Implicit resolution in spectral space:

    F_hat(tn+1) = 1/(1-nu*dt*sum(Ki**2)) * F_hat(tn)

apply(**kwds)

Abstract method that should be implemented. Applies this node (operator, computational graph operator…).

classmethod build_diffusion_filter(dim, *args, **kwds)[source]
setup(work)[source]

Setup temporary buffer that have been requested in get_work_properties(). This function may be used to execute post allocation routines. This sets self.ready flag to True. Once this flag is set one may call ComputationalGraphNode.apply() and ComputationalGraphNode.finalize().

Automatically honour temporary field memory requests.